#ifndef DATABASEMANAGER_H
#define DATABASEMANAGER_H

#include <QObject>
#include <QSqlDatabase>
#include <QSqlError>
#include <QFile>
#include <QDir>
#include <QSqlQuery>
#include <QVariant>
#include <QDebug>

class DatabaseManager : public QObject
{
public:
    DatabaseManager()
    {
        openDB();
        createDownloadsTable();
    }

    static DatabaseManager* getDBManager() {
        static DatabaseManager *instance = new DatabaseManager();
        return instance;
    }
    public:
        void close();
        int insertDownload(QString url, QString folder, int progress, int priority);
        int insertProgressDownload(int id, int progress);
        void deleteDownload(int id);

    private:
        QSqlDatabase db;

        bool openDB();
        bool deleteDB();
        bool createDownloadsTable();
};

#endif // DATABASEMANAGER_H
